/*! ******************************************************************************
 *
 * Created on 2022年2月22日
 *
 * Copyright(c) YuZhou Big Data Laboratory CO.,Ltd, 2022.  All rights reserved.
 *
 *******************************************************************************
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 ******************************************************************************/
package org.yzbdl.lanius.core.constant;

import java.io.File;

import org.pentaho.di.core.Const;

/**
 * 本地目录常量
 *
 * @author hs@yzbdl.ac.cn
 */
public class LocalDir {

    private static String pluginFolderName = "plugins";

    private static String marketPluginImageDir = "ui/images/market/plugins";

    private static String dataBasePluginImageDir = "ui/images/dataBase/plugins";

    private static String unitPluginLibFolder = "libplugins";

    public static String dbDriverFolder = "drivers";

    private static String pluginLibFolder = "lib";

    private static String iconsFolder = "icons";

    private static String screenshotsFolder = "screenshots";

    public static final String separator = File.separator;

    public static final String userName = System.getProperty("user.name");

    public static final String systemInfo = System.getProperty("os.name").toLowerCase();

    /**
     * 临时文件目录
     */
    public static final String TEMP = !systemInfo.contains("windows") ? System.getProperty("java.io.tmpdir")
        + File.separator + userName + File.separator + Const.PRODUCT_NAME + File.separator
        : System.getProperty("java.io.tmpdir") + Const.PRODUCT_NAME + File.separator;

    /**
     * 用户主目录
     */
    public static final String HOME = Const.getKettleDirectory();

    /**
     * 程序根目录
     */
    public static final String BASE = new File("").getAbsolutePath();

    /**
     * 插件目录 /plugins
     */
    public static final String PLUGIN = new File(pluginFolderName).getAbsolutePath();

    /**
     * 统一插件依赖包目录, 所有插件依赖包统一集中放置的目录, 返回libplugins的绝对路径
     */
    public static final String LIB_PLUGINS = new File(unitPluginLibFolder).getAbsolutePath();

    /**
     * 相对插件依赖包目录, 每个插件包下面单独的依赖包目录, 返回lib相对路径
     */
    public static final String LIB = pluginLibFolder;

    /**
     * 数据库驱动包目录, 返回drivers的绝对路径
     */
    public static final String DRIVER_DIR = new File(dbDriverFolder).getAbsolutePath();

    /**
     * 插件图标目录名称
     */
    public static final String PLUGIN_ICONS_DIR = iconsFolder;

    /**
     * 插件介绍截图目录名称
     */
    public static final String PLUGIN_SCREENSHOTS_DIR = screenshotsFolder;

//    /**
//     * 线上插件图片目录
//     */
//    public static final String MARKET_PLUGIN_IMAGE_DIR = new File(marketPluginImageDir).getAbsolutePath();
//
//    /**
//     * 线上数据库插件图片
//     */
//    public static final String DATABASE_PLUGIN_IMAGE_DIR = new File(dataBasePluginImageDir).getAbsolutePath();

}
